package com.by.controller;

import com.by.bean.EnterpriseCategory;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.EnterpriseCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "企业类目")
@RestController
@RequestMapping("/api")
public class EnterpriseCategoryController extends BaseController {


    @Autowired
    EnterpriseCategoryService enterpriseCategoryService;


    @ApiOperation("保存类别")
    @PostMapping("/category")
    public ResultBean save(@RequestBody EnterpriseCategory category) {
        int rs = enterpriseCategoryService.save(category);
        return saveResult(rs);
    }
    @ApiOperation("类目树")
    @GetMapping("/category/tree")
    public ResultBean tree(){
        List list=enterpriseCategoryService.tree();
        return success("类别书",list);
    }
}
